﻿using AutoMapper;
using Module.Test.Application.Dtos;
using Module.Test.Domain.Commands.Customs;
using Module.Test.Domain.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Module.Test.Application.AutoMapper
{
    public class CustomMapperProfile : Profile
    {
        /// <summary>
        /// 配置构造函数，用来创建关系映射
        /// </summary>
        public CustomMapperProfile()
        {
            //手动进行配置
            CreateMap<CustomDto, Custom>().ReverseMap();
            CreateMap<CustomDto, RegisterCustomCommand>().ConstructUsing(c => new RegisterCustomCommand(c.Id, c.Name)); 
            CreateMap<CustomDto, UpdateCustomCommand>().ConstructUsing(c => new UpdateCustomCommand(c.Id, c.Name));

        }
    }
}
